
package results;

import java.util.Iterator;
import java.util.Vector;

import objects.Station;

/**
 * Provides the reachable neigbours from a station.
 * 
 * @author Guillaume
 * @created June 8, 2004
 */

public class ProbeComReachableNeighbors extends ProbeCom {

	/** Property name monitored by the probe */
	private static final String PROPERTY_NAME = "ProbeComReachableNeighbors";

	/** Probe description */
	private static final String PROBE_DESCRIPTION = "";
	

	/**
	 * @param t
	 * @param probeName probe name
	 */
	public ProbeComReachableNeighbors(Station t,  String probeName) {
		super(COM_LOOP,t, probeName);
	}

	/** 
	 * Fetch the neighbors of the monitored station that can
	 * be reached.
	 *
	 * @return String representing the different neighbors in a String format  
	 * @see Results.Probe#getValue()
	 * @see Results.Probe#xmlTrace()
	 */
	protected Object getValue() {
		// vector of stations
		Vector v = ((Station) _linkedStation).getCurrentReachNeighbors(); 
		String s = "";
		if(!v.isEmpty()){
		    for(Object st : v){
			s += ((Station)st).getName() + ";";
		    }
		}else{
		    s = "none";
		}
		return (Object)s;
	}

	/**
	 * Get the property Name
	 * @return property name
	 * @see Results.Probe#getPropertyName()
	 */
	public String getPropertyName() {
		return PROPERTY_NAME;
	}

	/**
	 * Get the descitption of the probe
	 * @return probe description
	 * @see Results.Probe#getProbeDescription()
	 */
	public String getProbeDescription() {
		return PROBE_DESCRIPTION;
	}

	public static void main(String[] args) {
	}
}
